package com.xgs.system.domain.vo;

import java.util.Objects;

/**
 * @author JerryLu
 * @date 2024/12/10 18:32
 * @description 去重字段
 */
public class CompositeKey {
    private final String vehicleId;
    private final String endDate;
    private final String collectTime;
    private final Integer discountRate;

    public CompositeKey(String vehicleId, String endDate, String collectTime, Integer discountRate) {
        this.vehicleId = vehicleId;
        this.endDate = endDate;
        this.collectTime = collectTime;
        this.discountRate = discountRate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CompositeKey that = (CompositeKey) o;
        return Objects.equals(vehicleId, that.vehicleId) &&
                Objects.equals(endDate, that.endDate) &&
                Objects.equals(collectTime, that.collectTime) &&
                Objects.equals(discountRate, that.discountRate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(vehicleId, endDate, collectTime, discountRate);
    }
}
